''' Pixels1_functions with traversing a list with a for loop and index ''' from codex import * from time import sleep import random pix_colors = [(77, 158, 100), YELLOW, (203, 182, 6), RED, random.choice(COLOR_LIST), YELLOW, BLACK] pix_brights = [75, 50, random.randrange(100), 50, 100, 75, 0] delay = 1 def random_color(): red = random.randrange(256) green = random.randrange(256) blue = random.randrange(256) color = (red, green, blue) turn_pixels(color, 100, 1) def turn_pixels(color, brightness): for pix in range(4): pixels.set(pix, color, brightness) sleep(delay) # === Main program for index in range(len(pix_colors)): turn_pixels(pix_colors[index], pix_brights[index])